//
//  MessageDetailTitleCell.swift
//  koolcar
//
//  Created by kuaimaxiansheng on 2023/9/25.
//

import UIKit

class MessageDetailTitleCell: UITableViewCell {
    var titleLab: UILabel!
    var timeLab: UILabel!
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.backgroundColor = .white
        self.selectionStyle = .none
        self.clipsToBounds = true
        self.initUI()
    }
    
    func initUI(){
        
        self.titleLab = UILabel(frame: CGRect(x: 14, y: 10, width: kScreenWidth - 28, height: 20))
        self.titleLab.font = UIFont(name: Theme.PingFangSCMedium, size: 16)
        self.titleLab.textColor = Theme.titleLabColor
        self.titleLab.numberOfLines = 0
        self.contentView.addSubview(self.titleLab)
        
        self.timeLab = UILabel(frame: CGRect(x: 14, y: 0, width: kScreenWidth - 28, height: 20))
        self.timeLab.font = UIFont(name: Theme.PingFangSCRegular, size: 12)
        self.timeLab.textColor = Theme.placeholderColor
        self.contentView.addSubview(self.timeLab)
        
        self.titleLab.snp.makeConstraints { make in
            make.top.equalTo(10)
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.height.greaterThanOrEqualTo(20)
        }
        
        self.timeLab.snp.makeConstraints { make in
            make.top.equalTo(self.titleLab.snp.bottom).offset(6)
            make.left.equalTo(14)
            make.right.equalTo(-14)
            make.bottom.equalTo(-10)
        }
        
       
        
    }
    
    //setModel
    func setModel(model: MessageListModel){
        self.titleLab.text =  model.title ?? ""
        self.timeLab.text = XTManageCenter.checkTimes(createDate: model.createdTime ?? "")
    }
    
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
